<template>
  <div class="goods_item" @click="itemClick">
    <img :src="goodsItem.show.img" alt="" />
    <div class="goods_info">
      <p>{{ goodsItem.title }}</p>
      <span class="price">{{ goodsItem.price }}</span>
      <span class="collect">{{ goodsItem.cfav }}</span>
    </div>
  </div>
</template>

<script>
export default {
  name: 'GoodsListItem',
  props: {
    goodsItem: {
      type: Object,
      default() {
        return {}
      }
    }
  },
  methods: {
    itemClick() {
      this.$router.push('/detail/' + this.goodsItem.iid)
    }
  }
}
</script>

<style scoped>
.goods_item {
  padding-bottom: 40px;
  width: 48%;
  position: relative;
}
.goods_item img {
  width: 100%;
  border-radius: 5px;
}
.goods_info {
  /* 信息 */
  font-size: 14px;
  text-align: center;
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  overflow: hidden;
}
.goods_info p {
  /* 标题 */
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  margin-bottom: 3px;
}
.goods_info .price {
  /* 价格 */
  color: hotpink;
  margin-right: 30px;
}

.collect::before {
  display: inline-block;
  content: "";
  background: url("~assets/images/common/collect.svg") 0 0/14px 14px;
  position: relative;
  left: -3px;
  top: 1px;
  height: 14px;
  width: 14px;
}</style>
